	var request = {}
	
	request.requestAjax = function(type,route,data,resolve,reject,url,dataType,header){
		
		url = request.checkUrl(route,url)
		
	    !header ?  header = { 'Content-Type': 'application/json' } : header = { 'Content-Type': header };
	    
	    !!route ?  url  : url = url + type;
	    
	    !!dataType ?  dataType : dataType = "json";
	    
	    !!type ?  type : type = "post";
	    
	    mui.ajax(url,{
			data:data,
			dataType:dataType,//服务器返回json格式数据
			type:type,//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；
			headers:header,	             
			success:resolve,
			error:reject
		});
	}
	request.checkUrl = function(route,url){
		if(!!url){
			url = url
		}else{
			url="http://api.paradise4d.com/"+"reeserver/api/v1/"+route
		}
		return url;
	}
	request.getQueryStringArgs = function(){
		var str = window.location.href.split("?")[1]
		if(str){
			var qs = (location.search.length>0 ? location.search.substring(1) : str.substring(0,str.length-2));
		}else{
			var qs = '';
		}
		var args = {};
		var items = qs.length?qs.split("&"):[];
		var item = null;
		var name = null;
		var value = null;
		var len = items.length;
		for(var i = 0;i<len;i++){
			item = items[i].split("=");
			name = decodeURIComponent(item[0]);
		    value = decodeURIComponent(item[1]);
		    
		    if(name.length){
		    	args[name] = value;
		    }
		}
		return args;
	}

	//原生封装，暂时用不到
	request.xhrRequest = function(route,resolve,data,type,url){
			url = request.checkUrl(route,url);
			console.log(url);
		    var xhr=new XMLHttpRequest();
		    xhr.onreadystatechange= function(){
		        switch(xhr.readyState){
		            case 4:
		            plus.nativeUI.closeWaiting();
		            if(xhr.status==200){
		            	
		            }else{
		                console.log("检测更新失败！");
		                plus.nativeUI.alert("检测更新失败！");
		            }
		            break;
		            default:
		            break;
		        }
		    }
		    xhr.open('GET',url);
		    xhr.send();
	}
	

